<template>
	<view>
		<view class="counter">
			当前计数: {{ counter.counter }}
		</view>
		<button @click="increment">+1</button>
		<button @click="conunterStore.increment(5)">+5</button>
		<button @click="decrement">-1</button>
		<button @click="conunterStore.decrement(5)">-5</button>
		<button @click="navigateToCpns">跳转组件</button>
	</view>
</template>

<script setup>
	import { storeToRefs } from 'pinia'
	import useConunterStore from '../../store/modules/counter';
	const conunterStore = useConunterStore()
	const counter = storeToRefs(conunterStore)
	
	function increment(value = 1) {
		counter.counter.value++
	}
	
	function decrement(value = 1) {
		counter.counter.value++
	}
	
	function navigateToCpns() {
		uni.navigateTo({
			url: '/pages/10_pinia/c-views/counter'
		})
	}
</script>

<style>

</style>
